home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17861 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  47 lines

  1. Path: cypher.3do.com!user
  2. From: tsw@3do.com (Tom Watson)
  3. Newsgroups: comp.os.linux.setup,comp.os.linux.misc,comp.os.linux,comp.lang.c,comp.lang.c++
  4. Subject: Re: problems with GCC
  5. Date: Wed, 17 Apr 1996 11:30:09 -0800
  6. Organization: The 3DO Corporation
  7. Distribution: world
  8. Message-ID: <tsw-1704961130090001@cypher.3do.com>
  9. References: <4l1and$iql@news.ran.es>
  10. NNTP-Posting-Host: cypher.3do.com
  11.  
  12. In article <4l1and$iql@news.ran.es>, chano@ran.es (Chano G≤mez Martφnez) wrote:
  13.  
  14. > First of all, I want to apologize for my awful English.
  15. > Now, the C stuff :
  16. > I'm trying to port a C program from Borland C++ 3.1 to GCC under
  17. > Linux.
  18. > My problem is that I can't use any function from math.h !!!
  19. > The file is correctly #include'd ( in fact, I get no compilation
  20. > errors ) but the linker always tells me something like :
  21. > /tmp/cca000971.o(.text+0x39): undefined reference to `exp'
  22. > The funny thing is that GPC ( the GNU Pascal compiler ) allows me to
  23. > use math.h functions lihe exp(), sin(), fabs(), etc, but when I
  24. > convert my Pascal programs to C with p2c and try to compile them with
  25. > GCC , I get the same error again.
  26. <<<deletia regarding GPC and gcc>>>
  27. > The only apparent difference between both results is in the libraries
  28. > ( I think)
  29. > Can anyone help me, please ???
  30.  
  31. Yes, the difference is in the libraries.  To use exp, sin, ...
  32. you need to include '-lm' (at least on your system) in the invoking 'gcc'
  33. line.  The GPC thing had it already included.  Most functions in <math.h>
  34. need the '-lm' addition if compiled under a Unix style compiler.  This is
  35. probably an FAQ! (see the C faq's on the friendly 'rtfm' server).
  36.  
  37. -- 
  38. Tom Watson
  39. tsw@3do.com         (Home: tsw@johana.com)
  40.